<?php
include_once "./Reader.php";
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Wix
 *
 * @author 梅小春 476984957@qq.com
 */
class Wix {
    public $title; // 标题
    public $imageCount; // 图片数量
    public $imageIndexs; // 每张图片的索引位置
    
    public static function getObject($file){
        $obj = new Wix();
        $f = fopen($file, 'rb');
        $obj->title = Reader::getTitle($f);
        $obj->imageCount = Reader::Integer($f);//标题之后的第一个4字节是图片长度
        $obj->imageIndexs = [];
        for($i=0;$i<$obj->imageCount;$i++){
            array_push($obj->imageIndexs, Reader::Integer($f)); // 之后每个4字节都是图片地址索引，fseek 的参数
        }
        fclose($f);
        return $obj;
    }
    
}
